<?php
		require (LIB_ROOT . 'Smarty/libs/Smarty.class.php');
		
		$smarty = new Smarty ();
		// $smarty->force_compile = true;
		$smarty->debugging = false;
		#$smarty->cache_lifetime = 120;
		$smarty->caching = false;
		
		
		global $_SGLOBAL;
		if(isset($_SGLOBAL['usepath']) && isset($_SGLOBAL['path'])){	
				
	
			$path=empty($_SGLOBAL['path'])?'':'/'.($_SGLOBAL['path']);
			
			$smarty->template_dir = ROOT . "ui/templates".$path;
			$smarty->compile_dir = ROOT . "Cache/template/templates_c".$path;
			$smarty->config_dir = ROOT . "ui/config".$path;
			$smarty->cache_dir = ROOT . "Cache/template/cache".$path;
			$smarty->assign ( 'perpage', PERPAGE );
			
			$smarty->assign ( 'ui_site', "./ui/ui/" );
			$smarty->assign ( 'tem_site', "./ui/templates".$path."/" );
		}else{
			$smarty->template_dir = ROOT . "ui/templates";
			$smarty->compile_dir = ROOT . "Cache/template/templates_c";
			$smarty->config_dir = ROOT . "ui/config";
			$smarty->cache_dir = ROOT . "Cache/template/cache";
			
			$smarty->assign ( 'perpage', PERPAGE );
			
			$smarty->assign ( 'ui_site', "./ui/ui/" );
			$smarty->assign ( 'tem_site', "./ui/templates/" );
		}
		
		return $smarty;
	
?>
